<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%><%@page import="java.util.Map"%>

<%@ include file="../common/commonJS.jsp" %>
<%@ include file="../common/commonLabel.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>未开工信息列表</title>
</head>
<script type="text/javascript">
function del(cid){
	if(confirm("确定删除该生产单吗？")){
		window.location.href="<%=request.getContextPath()%>/clientDel.action?cid="+cid;
	}
	
}

function setMachine(tid){
	doQueryMess("/pressystem/MachineList.action?operate=inspage&taskid="+tid+"","","750","500");
}

function resetMachine(tid,mtid){
	doQueryMess("/pressystem/MachineList.action?operate=inspage&isreset=true&mtid="+mtid+"&taskid="+tid+"","","750","500");
}

function doStart(tid,mid){
	if(confirm("确定开工吗？")){
		document.all["machineid"].value = mid;
		document.all["taskid"].value = tid;
		document.all["operate"].value = "dostart";
		document.forms[0].submit();
	}
}
</script>
<body>
<form action="<%=request.getContextPath()%>/taskstart.action" method="post">
<table width="85%" border="0" cellpadding="0" cellspacing="0" >
  <tr>
     <td>
     <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" class="MainBody">
      <tr>
        <td width="760" class="MainBody_title"><hello:forValue type="title" /></td>
      </tr>
      <tr>
        <td class="MainBody_body" ><input name="operate" type="hidden" value="notstart"/>
        <input name="taskid" type="hidden" value=""/>
        <input name="machineid" type="hidden" value=""/>
        <input name="createuser" type="hidden" value="${sessionScope.admin_user.personname}"/>
        <table border="0" cellpadding="0" cellspacing="0"  class="MainBody_table">
           <tr>
				<th nowrap="nowrap" width="5%">序号</th>
				<th nowrap="nowrap" width="15%">订单名称</th>
				<th nowrap="nowrap" width="15%">生产单名称</th>
				<th nowrap="nowrap" width="7%">印刷尺寸</th>
				<th nowrap="nowrap" width="7%">版数(套)</th>
				<th nowrap="nowrap" width="7%">CTP</th>
				<th nowrap="nowrap" width="7%">成品数量</th>
				<th nowrap="nowrap" width="7%">机台编号</th>
				<th nowrap="nowrap" width="7%">机台名称</th>
				<th nowrap="nowrap" width="7%">机台状态</th>
				<th nowrap="nowrap" width="5%">排序</th>
				<th nowrap="nowrap" width="8%">操作</th>
			</tr>

             	<% 
             	  if(request.getAttribute("listinfo")!=null){
             		List list = (List)request.getAttribute("listinfo");
             		for(int i=0;i<list.size();i++){
             			Map c = (Map)list.get(i);
             	 %>
			<tr>
				<td align="center" nowrap="nowrap"><%=i+1 %></td>
				<td align="center" nowrap="nowrap"><%=c.get("name")==null?"":c.get("name") %></td>
				<td align="center" nowrap="nowrap"><a href="<%=request.getContextPath()%>/taskSel.action?tid=<%=c.get("taskid") %>&oid=<%=c.get("orderid") %>" title="生产单详细信息"><%=c.get("taskName") %></a></td>
				<td align="center" nowrap="nowrap"><%=c.get("printSize")==null?"":c.get("printSize") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("versionAmount")==null?"":c.get("versionAmount") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("CTP") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("amount")==null?"":c.get("amount") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("machineid")==null?"":c.get("machineid") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("machinename")==null?"":c.get("machinename") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("machstatus")==null?"":c.get("machstatus") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("orders")==null?"":c.get("orders") %></td>
				<td align="center" nowrap="nowrap">
				<%if(c.get("machineid")!=null&&!"".equals(c.get("machineid"))){
					if(c.get("orders")!=null&&!"".equals(c.get("orders"))){
						if("空闲".equals(c.get("machstatus"))){
				%>
				<span class='RoleSpan' onclick="doStart('<%=c.get("taskid") %>','<%=c.get("machineid")==null?"":c.get("machineid") %>')" title='开工' style='color: red;' onmouseout="doMsOut('red')" onmouseover='doMsOver()'>开工</span>
				<%
						}else{
				%>
							机台繁忙
				<%						
					}}else{
				%>
						等待排产
				<%}}else{
				%>	
			    	等待分配机台
				<%} %>
				</td> 
			</tr>
			<%}//for end
             }%>
          <c:if test="${empty listinfo}">
			<tr>
				<td colspan="12" align="center">暂时没有您可以浏览的数据</td>
			</tr>
		</c:if>
          </table>
          <c:if test="${!empty listinfo}">
          <table border="0" cellpadding="0" cellspacing="0" class="MainBody_fun">
            <tr>
              <td>
               <hello:AllPage />
			  </td>
            </tr>
          </table>
          </c:if>
          </td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>